package com.xyc.px;

import com.cinsea.common.ActionType;
import com.cinsea.common.BasePX;
import com.cinsea.common.Env;
import com.cinsea.common.JdbcDao;
import com.cinsea.security.service.RightService;
import com.cinsea.util.StringUtil;

import java.util.List;
import java.util.Map;

public class XycPx extends BasePX {
    @Override
    public void after(Map context) {
        JdbcDao jdbcDao = Env.getBean("jdbcDao");
        String actiontype = StringUtil.null2String(context.get("actiontype"));
        Map m=(Map)context.get("parameters");
        String yhry =  StringUtil.null2String(m.get("ut_floorinfo_yhry"));
        String suoshulouyu=String.valueOf(context.get("processid"));
        if(actiontype.equals(ActionType.EDIT_FORMPROCESS)){
            String sql="update ut_floorinfo set yhry ='"+yhry+"' where suoshulouyu='"+suoshulouyu+"'";
            jdbcDao.update(sql);
            String  sq ="select processid from ut_floorinfo where suoshulouyu='"+suoshulouyu+"'";
            List list = jdbcDao.queryForList(sq);
            RightService rightService=Env.getBean("rightService");
            if(list!=null&&list.size()>0){
                for(int i=0;i<list.size();i++){
                     Map m1 = (Map)list.get(i);
                    String s = m1.get("processid").toString();
                    rightService.reCreateRightdetail(s, "0", "ut_floorinfo");
                }

            }
        }
    }

}
